﻿<UserControl x:Class="Sautom.Modules.Proposal.Views.CountriesList"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:res="clr-namespace:Sautom.I18N;assembly=Sautom.I18N"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="250*" />
        </Grid.RowDefinitions>
        <Menu Grid.Row="0">
            <MenuItem Header="{Binding Source={x:Static res:ProposalResources.CreateCountryBtn}}" Command="{Binding EditCountryCommand}" CommandParameter="true" />
            <MenuItem Header="{Binding Source={x:Static res:ProposalResources.EditContryBtn}}" Command="{Binding EditCountryCommand}" CommandParameter="false"/>
        </Menu>
        <DataGrid Grid.Row="1" IsReadOnly="True" ItemsSource="{Binding Countries}" SelectionMode="Single" 
                  SelectionUnit="FullRow" SelectedItem="{Binding SelectedItem}" CanUserReorderColumns="False" 
                  CanUserResizeColumns="False" CanUserResizeRows="False" CanUserSortColumns="True" 
                  AlternatingRowBackground="Gainsboro"  AlternationCount="2" AutoGenerateColumns="False">
            <DataGrid.Columns>
                <DataGridTextColumn Header="{Binding Source={x:Static res:ProposalResources.CountryLabel}}" Binding="{Binding Path=CountryName}" />
                <DataGridTextColumn Header="{Binding Source={x:Static res:ProposalResources.CitiesLabel}}" Binding="{Binding Path=CitiesList}" />
            </DataGrid.Columns>
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseDoubleClick">
                    <i:InvokeCommandAction Command="{Binding EditCountryCommand}" CommandParameter="false" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </DataGrid>

    </Grid>
</UserControl>
